package com.shanglv.train.repository.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.shanglv.train.mapper.DemoMapper;
import com.shanglv.train.model.Demo;

@Repository
public class DemoRepository {
	
	@Autowired
	private DemoMapper demoMapper;

	public void addDemo(Demo demo) {
		demoMapper.insert(demo);
	}

	public void deleteById(Integer id) {
		demoMapper.deleteByPrimaryKey(id);
	}

	public void updateDemo(Demo demo) {
		demoMapper.updateByPrimaryKeySelective(demo);
	}

	public Demo getById(Integer id) {
		return demoMapper.selectByPrimaryKey(id);
	}
	
	

}
